package ro.upt.ac.cstaicu.execution;

/**
 * Models the test after it has been executed.
 * 
 * @author Cristian-Alexandru STAICU
 * 
 */
public class TestResult {

	/**
	 * The result of the test. It's value should be TEST_PASSED or TEST_FAILED
	 * from the Executor class.
	 */
	public final int result;
	/**
	 * The name of the class that contains the test
	 */
	public final String testClassName;
	/**
	 * The name of the method that represents the test.
	 */
	public final String testMethodName;
	
	/**
	 * The output of the test
	 */
	public final String output;

	/**
	 * Initializes the current test
	 * 
	 * @param methodClassName
	 *            - name of the test method
	 * @param testClassName
	 *            - name of the test class
	 * @param result
	 *            the result of the test execution
	 */
	public TestResult(String testClassName, String methodClassName, int result, String output) {
		this.testMethodName = methodClassName;
		this.testClassName = testClassName;
		this.result = result;
		this.output = output;
	}
	
	@Override
	public String toString() {	
		return testClassName + " " + testMethodName + " " + result;  
	}

	public boolean failed() {
		return result == Executor.TEST_FAILED;
	}

}
